/*
 * @LastEditors: 七七
 * @Date: 2023-01-07 16:17:10
 */
import React, { Component } from 'react'


const detailData = [
  { id: '01', content: '宁' },
  { id: '02', content: '玉' },
  { id: '03', content: '杰' },
]

export default class Detail extends Component {
  render() {
    console.log(this.props);
    // 接收state参数(如果没有参数传递空undefined)
    const { id, title } = this.props.location.state || {}
    const findResult = detailData.find((detailObj) => {
      return detailObj.id === id
    }) || {}
    return (
      <ul>
        <li>ID:{id}</li>
        <li>TITLE:{title}</li>
        <li>CONTENT:{findResult.content}</li>
      </ul>
    )
  }
}
